<?php
/*
 * @FileForDetails: 校区验证器
 * @Date: 2022-11-30 15:35:30
 */
namespace app\crm\validate\product;

use think\Validate;

class Campus extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'name' => "require|max:100",
        'campus_no' => "require|max:30",
        'phone' => "require|max:20",
        'address' => "require|max:100",
        // 'province' => "require",
        // 'city' => "require",
        // 'county' => "require",
    ];

    /**
     * 提示消息
     */
    protected $message = [
        // 'name'      => "校区名称必须填写",
        // 'campus_no' => "校区编码必须填写",
        // 'phone'     => "校区电话必须填写",
        // 'province'  => "省份必须填写",
        // 'city'      => "城市必须填写",
        // 'county'    => "地区必须填写",
        // 'address'   => "详细地址必须填写",
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add' => [],
        'edit' => [],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'name'      => "校区名称",
            'campus_no'   => "校区编码",
            'phone'  => "校区电话",
            // 'province' => "省份",
            // 'city'     => "城市",
            // 'county'     => "地区",
            'address'    => "详细地址",
        ];

        parent::__construct($rules, $message, $field);
    }
}